package com.config;

import feign.hystrix.HystrixFeign;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import feign.Feign;

@Configuration
public class EurekaConfiguration {
	
	/**
	 * 禁用单个feignClient的hystrix的支持：
	 * configuration--->FeignClientsConfiguration.java
	 * HystrixFeign.builder()--->Feign.builder()
	 * 
	 *
	 * eureka-server关闭之后：不会走断路器的fallback
	 * 异常结果：feign.RetryableException: Connection refused:
	 * 
	 * 
	 *
	 * 源码：
	 * @Configuration
	@ConditionalOnClass({ HystrixCommand.class, HystrixFeign.class })
	protected static class HystrixFeignConfiguration {
		@Bean
		@Scope("prototype")
		@ConditionalOnMissingBean
		@ConditionalOnProperty(name = "feign.hystrix.enabled")
		public Feign.Builder feignHystrixBuilder() {
			return HystrixFeign.builder();
		}
	}
	 * 
	 * 
	 * http://localhost:8085/sunxj-microservice-provider-user
	 * 
	 */
	@Bean
	@Scope("prototype")
	public Feign.Builder feignBuilder() {

		return Feign.builder();
//		return HystrixFeign.builder();
	}
	

}
